cmake_minimum_required(VERSION 3.5)
set(PROJ_NAME miniipc)

project(${PROJ_NAME})

if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
    message(STATUS "Debug build")
    message(STATUS "Enable debugging information and ASAN")
    # 设置 debug 版本的编译器标志或其他设置
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -g ")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address  -g ")
elseif(${CMAKE_BUILD_TYPE}  STREQUAL "Release")
    message(STATUS "Release build")
    # 设置 release 版本的编译器标志或其他设置
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -DNDEBUG")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -DNDEBUG")
endif()
set(CMAKE_CXX_STANDARD 14)
include_directories("${CMAKE_SOURCE_DIR}/include")
include_directories("${CMAKE_SOURCE_DIR}/src")

LINK_LIBRARIES(cjson)

#add_library(miniipc SHARED src/miniipc.cpp include/miniipc.h main.cpp)
add_executable(miniipc src/miniipc.cpp include/miniipc.h main.cpp include/Mlink.h src/Mlink.cpp)